Created
February 3, 2017 08:11
-
-
Save millerf/244b6aed5e46a118717138c5812f32ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_mzk_id_is_saved_ang_get_properly(self): | |
# Test connection | |
content1 = Content(mzk_id="A") | |
# before saving | |
self.assertIs(content1.mzk_id, "A") | |
content1.save() | |
# after saving | |
self.assertIs(content1.mzk_id, "A") | |
def test_mzk_id_is_retrieved_properly(self): | |
# Test connection | |
content1 = Content(mzk_id="a") | |
content1.save() | |
c = Content.objects.get(pk="a") | |
self.assertIs(c.mzk_id, "A") | |
def test_mzk_id_has_to_be_a_string(self): | |
# Test connection | |
with self.assertRaises(TypeError): | |
c = Content(mzk_id=12) | |
c.save() | |
def test_incrementation_of_content_mzk_id(self): | |
# Test connection | |
c1 = Content(name="a") | |
c1.save() | |
c2 = Content(name="ab") | |
c2.save() | |
mzk = c1.mzk_id | |
mzk2 = c2.mzk_id | |
# Where my error is: | |
# TypeError: int() can't convert non-string with explicit base | |
# Although I am expecting mzk2 to be a base32 str | |
mzk2= int(mzk2, 36) | |
self.assertEqual(mzk + 1, mzk2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment