Skip to content

Commit

Permalink
unit test polishing
Browse files Browse the repository at this point in the history
Add YottaModule unit tests
  • Loading branch information
PrzemekWirkus committed Feb 16, 2016
1 parent c12a3ff commit ac817f2
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mbed_greentea/mbed_yotta_module_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def init(self):
self.__yotta_module = {}
return bool(len(self.__yotta_module))

def set_yotta_config(self, yotta_module):
def set_yotta_module(self, yotta_module):
self.__yotta_module = yotta_module

def get_data(self):
Expand Down
3 changes: 2 additions & 1 deletion test/mbed_gt_yotta_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"""

import unittest
from mbed_greentea.mbed_yotta_target_parse import YottaConfig
from mbed_greentea.mbed_yotta_module_parse import YottaConfig


class YOttaConfigurationParse(unittest.TestCase):

Expand Down
70 changes: 70 additions & 0 deletions test/mbed_gt_yotta_module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/env python
"""
mbed SDK
Copyright (c) 2011-2015 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""

import unittest
from mbed_greentea.mbed_yotta_module_parse import YottaModule


class YOttaConfigurationParse(unittest.TestCase):

def setUp(self):
self.YOTTA_MODULE_LONG = {
"name": "utest",
"version": "1.9.1",
"description": "Simple test harness with unity and greentea integration.",
"keywords": [
"greentea",
"testing",
"unittest",
"unity",
"unit",
"test",
"asynchronous",
"async",
"mbed-official"
],
"author": "Niklas Hauser <[email protected]>",
"license": "Apache-2.0",
"dependencies": {
"minar": "^1.0.0",
"core-util": "^1.0.1",
"compiler-polyfill": "^1.2.0",
"mbed-drivers": "~0.12.0",
"greentea-client": "^0.1.2"
},
"testDependencies": {
"unity": "^2.0.1",
"greentea-client": "^0.1.2"
}
}

self.yotta_module = YottaModule()
self.yotta_module.set_yotta_module(self.YOTTA_MODULE_LONG)

def tearDown(self):
pass

def test_get_name(self):
self.assertEqual('utest', self.yotta_module.get_name())

def test_get_dict_items(self):
self.assertEqual('Simple test harness with unity and greentea integration.', self.yotta_module.get_data().get('description'))
self.assertEqual('Apache-2.0', self.yotta_module.get_data().get('license'))

if __name__ == '__main__':
unittest.main()

0 comments on commit ac817f2

Please sign in to comment.