chmullig avatar chmullig committed a82e396

Some more tests, and removing junk that never should have been added.

Comments (0)

Files changed (4)

Add a comment to this file

tests/unit/__init__.pyc

Binary file removed.

Add a comment to this file

tests/unit/pmxbot.sqlite

Binary file removed.

tests/unit/test_commands.py

 		pmxbot.run(configFile=configfile, start=False)
 		pmxbot.botbase.logger.message("logged", "testrunner", "some text")
 		
+	@classmethod
+	def teardown_class(self):
+		path = os.path.dirname(os.path.abspath(__file__))
+		os.remove(os.path.join(path, 'pmxbot.sqlite'))
+
 	def test_google(self):
 		"""
 		Basic google search for "pmxbot". Result must contain a link.
 		assert len(flags) == 3
 		assert i < 30
 
+	def test_calc_simple(self):
+		"""
+		Test the built-in python calculator with a simple expression - 2+2
+		"""
+		res = pmxbot.calc(c, e, "#test", "testrunner", "2+2")
+		assert res == "4"
+		
+	def test_calc_complex(self):
+		"""
+		Test the built-in python calculator with a more complicated formula
+		((((781**2)*5)/92835.3)+4)**0.5
+		"""
+		res = pmxbot.calc(c, e, "#test", "testrunner", "((((781**2)*5)/92835.3)+4)**0.5")
+		assert res.startswith("6.070566")
+		
+	def test_define_keyboard(self):
+		"""
+		Test the wikipedia dictionary with the word keyboard.
+		"""
+		res = pmxbot.defit(c, e, "#test", "testrunner", "keyboard")
+		assert res.startswith("Wikipedia says: In computing, a keyboard is an input device, partially modeled after the typewriter keyboard,")
+
+	def test_define_irc(self):
+		"""
+		Test the wikipedia dictionary with the word IRC.
+		"""
+		res = pmxbot.defit(c, e, "#test", "testrunner", "irc")
+		assert res.startswith("Wikipedia says: Internet Relay Chat (IRC) is a form of real-time Internet text messaging (chat) or synchronous conferencing")
+
+	def test_urb_irc(self):
+		"""
+		Test the urban dictionary with the word IRC.
+		"""
+		res = pmxbot.urbandefit(c, e, "#test", "testrunner", "irc")
+		assert res == "Urban Dictionary says IRC: Abbreviation for Internet Relay Chat. A multiplayer notepad."
+
+	def test_acronym_irc(self):
+		"""
+		Test acronym finder with the word IRC.
+		"""
+		res = pmxbot.acit(c, e, "#test", "testrunner", "irc")
+		assert "Internet Relay Chat" in res
+		assert "|" in res
+		
+	def test_progress(self):
+		"""
+		Test the progress bar
+		"""
+		res = pmxbot.progress(c, e, "#test", "testrunner", "1|98123|30")
+		print res
+		assert res == "1 [===       ] 98123"
 
 #	def test_yahoolunch_zip(self):
 #		"""
Add a comment to this file

tests/unit/test_commands.pyc

Binary file removed.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.