Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixing the most important bug ever.

more tests for user programs
  • Loading branch information...
commit 83fdff9a69229948841cf17d887b507dbced6544 1 parent 4df46ad
BuzzTroll authored
View
7 .idea/inspectionProfiles/profiles_settings.xml
@@ -1,7 +0,0 @@
-<component name="InspectionProjectProfileManager">
- <settings>
- <option name="PROJECT_PROFILE" value="Project Default" />
- <option name="USE_PROJECT_PROFILE" value="true" />
- <version value="1.0" />
- </settings>
-</component>
View
3  cumulus/install.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-if [ "X$1" == "X--help" ]; then
+if ([ "X$1" == "X--help" ] || [ "X$1" == "X-h" ]); then
echo "install.sh [<installation directory>]"
exit 0
fi
@@ -21,6 +21,7 @@ else
if [ "X$?" != "X0" ]; then
echo "Copy to $installdir failed"
echo "verify that you can write to that directory"
+ exit 1
fi
cd $source_dir
fi
View
52 cumulus/tests/client/user_tests.py
@@ -16,6 +16,7 @@
import tempfile
import filecmp
import pycb.tools.add_user
+import pycb.tools.list_users
import pycb.tools.remove_user
#
class TestAddUsers(unittest.TestCase):
@@ -26,8 +27,59 @@ def setUp(self):
def tearDown(self):
pass
+ def find_in_file(self, fname, needle):
+ found = False
+ f = open(fname)
+ l = f.readline()
+ while l:
+ x = l.find(needle)
+ if x >= 0:
+ found = True
+ l = f.readline()
+ f.close()
+ os.unlink(fname)
+ return found
+
+
def test_new_user(self):
rc = pycb.tools.add_user.main(["test@nosetests.nimbus.org"])
self.assertEqual(rc, 0, "rc = %d" % (rc))
rc = pycb.tools.remove_user.main(["test@nosetests.nimbus.org"])
self.assertEqual(rc, 0, "rc = %d" % (rc))
+
+ def test_list_user(self):
+ display_name = str(uuid.uuid1())
+ rc = pycb.tools.add_user.main([display_name])
+ self.assertEqual(rc, 0, "rc = %d" % (rc))
+
+ (tmpFD, outFileName) = tempfile.mkstemp("cumulustests")
+ os.close(tmpFD)
+
+ rc = pycb.tools.list_users.main(["-O", outFileName, display_name])
+ self.assertEqual(rc, 0, "rc = %d" % (rc))
+ rc = self.find_in_file(outFileName, display_name)
+ self.assertTrue(rc, "display name not found in list")
+
+ rc = pycb.tools.remove_user.main([display_name])
+ self.assertEqual(rc, 0, "rc = %d" % (rc))
+
+ def test_column_report(self):
+ display_name = str(uuid.uuid1())
+ rc = pycb.tools.add_user.main([display_name])
+ self.assertEqual(rc, 0, "rc = %d" % (rc))
+
+ (tmpFD, outFileName) = tempfile.mkstemp("cumulustests")
+ os.close(tmpFD)
+
+ rc = pycb.tools.list_users.main(["-O", outFileName, "-b", "-r", "friendly,quota", display_name])
+ self.assertEqual(rc, 0, "rc = %d" % (rc))
+
+ n = "%s,None" % (display_name)
+ rc = self.find_in_file(outFileName, display_name)
+ self.assertTrue(rc, "display name not found in list")
+
+ rc = pycb.tools.remove_user.main([display_name])
+ self.assertEqual(rc, 0, "rc = %d" % (rc))
+
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.