Skip to content

Commit

Permalink
[openwrt] Fixed tests expecting automatic timezone #87
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed Jul 5, 2017
1 parent cda5e9d commit b6637d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
14 changes: 2 additions & 12 deletions tests/openwisp/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,30 +119,20 @@ class TestBackend(unittest.TestCase, _TabsMixin):
}

def test_uci(self):
o = OpenWisp({
"general": {
"hostname": "openwisp-test"
}
})
o = OpenWisp({"general": {"hostname": "openwisp-test"}})
tar = tarfile.open(fileobj=o.generate(), mode='r')
system = tar.getmember('uci/system.conf')
contents = tar.extractfile(system).read().decode()
expected = self._tabs("""package system
config system 'system'
option hostname 'openwisp-test'
option timezone 'UTC'
option zonename 'UTC'
""")
self.assertEqual(contents, expected)
tar.close()

def test_hostname_required(self):
o = OpenWisp({
"general": {
"timezone": "UTC"
}
})
o = OpenWisp({"general": {"timezone": "UTC"}})
with self.assertRaises(ValidationError):
o.validate()

Expand Down
8 changes: 2 additions & 6 deletions tests/openwrt/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,7 @@ def test_parse_tar_bytesio(self):
{
".type": "system",
".name": "system",
"hostname": "parse-tar-bytesio",
"timezone": "UTC",
"zonename": "UTC"
"hostname": "parse-tar-bytesio"
}
]
}
Expand All @@ -231,9 +229,7 @@ def test_parse_tar_file(self):
{
".type": "system",
".name": "system",
"hostname": "parse-tar-file",
"timezone": "UTC",
"zonename": "UTC"
"hostname": "parse-tar-file"
}
]
}
Expand Down

0 comments on commit b6637d7

Please sign in to comment.