You used flags.DEFINE_integer, so the int()'s above are redundant. Not sure any of those functions are really necessary?
Throughout the test cases in TestServerCreateRequestXMLDeserializer, you put backslashes on the end of text lines, when the text is encloses in """'s. This is incorrect and these need to be removed. As an example:
This is important, because currently, you are testing an invalid XML string (having a \ between attributes and in other places, having a \ between element tags) and the serializer tests are apparently passing.
The test case above technically passes. However, try adding in an additional <meta>gamma</meta> and see if the test passes ;)
Generally, when testing the parsing/deserialization of lists/dicts, you will want to add at least one test that has >1 element in the list being tested, and check that tests with one element work the same as tests with >1 element. Please feel free to add a test case for each of these cases:
1) >1 metadata element with no key
2) >1 injected file in the personality
3) >1 personality in the server
I think you may find some interesting results :)
The tests in TestServerInstanceCreation look excellent. Nice work on those!
Hi!
Good stuff :)
As mentioned on IRC, I'd suggest a global search and replace:
s/onset_ files/injected_ files/g
104 + expl = 'Bad personality format: missing %s' % key est(explanation ='Bad personality format')
107 + raise exc.HTTPBadRequ
111 + msg = 'Personality content for %s cannot be decoded' % path
121 + expl = "Personality file limit exceeded"
124 + expl = "Personality file path too long"
127 + expl = "Personality file content too long"
Please i18n all those! If you're unclear on how to do that, let us know.
309 + return int(FLAGS. quota_max_ onset_files) quota_max_ onset_file_ content_ bytes) quota_max_ onset_file_ path_bytes)
314 + return int(FLAGS.
319 + return int(FLAGS.
You used flags.DEFINE_ integer, so the int()'s above are redundant. Not sure any of those functions are really necessary?
Throughout the test cases in TestServerCreat eRequestXMLDese rializer, you put backslashes on the end of text lines, when the text is encloses in """'s. This is incorrect and these need to be removed. As an example:
364 + def test_minimal_ request( self): docs.rackspacec loud.com/ servers/ api/v1. 0"\ server- test" imageId="1" flavorId="1"/>""" er.deserialize( serial_ request) ls(request, expected)
365 + serial_request = """
366 +<server xmlns="http://
367 + name="new-
368 + request = self.deserializ
369 + expected = {"server": {
370 + "name": "new-server-test",
371 + "imageId": "1",
372 + "flavorId": "1",
373 + }}
374 + self.assertEqua
Should be:
def test_minimal_ request( self): docs.rackspacec loud.com/ servers/ api/v1. 0" server- test" imageId="1" flavorId="1"/>""" er.deserialize( serial_ request) assertEquals( request, expected)
serial_request = """
<server xmlns="http://
name="new-
request = self.deserializ
expected = {"server": {
"name": "new-server-test",
"imageId": "1",
"flavorId": "1"}}
self.
This is important, because currently, you are testing an invalid XML string (having a \ between attributes and in other places, having a \ between element tags) and the serializer tests are apparently passing.
507 + def test_request_ with_metadata_ missing_ key(self) : docs.rackspacec loud.com/ servers/ api/v1. 0"\ server- test" imageId="1" flavorId="1">\ <meta>beta< /meta>< /metadata> </server> """ er.deserialize( serial_ request) ls(request[ "server" ]["metadata" ], expected)
508 + serial_request = """
509 +<server xmlns="http://
510 + name="new-
511 +<metadata>
512 + request = self.deserializ
513 + expected = {"": "beta"}
514 + self.assertEqua
The test case above technically passes. However, try adding in an additional <meta>gamma</meta> and see if the test passes ;)
Generally, when testing the parsing/ deserialization of lists/dicts, you will want to add at least one test that has >1 element in the list being tested, and check that tests with one element work the same as tests with >1 element. Please feel free to add a test case for each of these cases:
1) >1 metadata element with no key
2) >1 injected file in the personality
3) >1 personality in the server
I think you may find some interesting results :)
The tests in TestServerInsta nceCreation look excellent. Nice work on those!
Cheers!
jay