# Path: publications/tests/tests.py
# class Tests(TestCase):
# 	def setUp(self):
# 	def test_authors(self):
# 	def test_citekey(self):
# 	def test_custom_links(self):
# 	def test_publications(self):
# 	def test_bibtex_import(self):
# 	def test_unapi(self):
# 	def test_admin(self):
# 	def test_extras(self):
# TEST_BIBLIOGRAPHY_COUNT = 9
# TEST_BIBLIOGRAPHY = r"""
# @article{Bethge2002c,
#   author = "M. Bethge and D. Rotermund and K. Pawelzik",
#   title = "Optimal short-term population coding: when Fisher information fails",
#   year = 2002,
#   journal = "Neural Computation",
#   month = "Oct",
#   keywords = "population coding, fisher information",
#   doi = "10.1162/08997660260293247",
#   url = "http://www.mitpressjournals.org/doi/abs/10.1162/08997660260293247"
# }
# 
# @article{Simovski2011,
#   author =        {Simovski, Constantin R.},
#   journal =       {J. Opt.},
#   month =         jan,
#   number =        {1},
#   pages =         {013001},
#   title =         {{On electromagnetic characterization and
#                    homogenization of nanostructured metamaterials}},
#   volume =        {13},
#   year =          {2011},
#   doi =           {10.1088/2040-8978/13/1/013001},
#   issn =          {2040-8978},
#   url =           {http://stacks.iop.org/2040-8986/13/i=1/
#                   a=013001?key=crossref.7321766a6630b917c6f066f2abc1e2cc},
# }
# 
# @inproceedings{gerwinn2008bayesian,
#   title={Bayesian inference for spiking neuron models with a sparsity prior},
#   author={Gerwinn, Sebastian and Macke, Jakob and Seeger, Matthias and Bethge, Matthias},
#   booktitle={Proceedings of the 21st Annual Conference on Neural Information Processing Systems},
#   number={EPFL-CONF-161311},
#   pages={529--536},
#   year={2008}
# }
# 
# @article{hafner2000dynamical,
#   title={A dynamical model of the inner Galaxy},
#   author={H{\"a}fner, Ralf and Evans, N Wyn and Dehnen, Walter and Binney, James},
#   journal={Monthly Notices of the Royal Astronomical Society},
#   volume={314},
#   number={3},
#   pages={433--452},
#   year={2000},
#   publisher={Oxford University Press}
# }
# 
# @misc{test:2009,
#     title = "Test",
#     author = {Last-Name, First and Peter van der Markt III and Test and Gauss II CF},
#     year = 2009
# }
# 
# @article{DBLP:journals/corr/KummererWB14,
#  author    = {Matthias K{\"{u}}mmerer and
#               Thomas Wallis and
#               Matthias Bethge},
#  title     = {How close are we to understanding image-based saliency?},
#  journal   = {CoRR},
#  year      = {2014},
#  volume    = {abs/1409.7686},
#  url       = {http://arxiv.org/abs/1409.7686},
#  timestamp = {Mon, 27 Oct 2014 13:50:21 +0100},
#  biburl    = {http://dblp.uni-trier.de/rec/bib/journals/corr/KummererWB14},
#  bibsource = {dblp computer science bibliography, http://dblp.org}
# }
# @incollection{dougan2014objective,
#   title={Objective Functions},
#   author={Do{\u{g}}an, Haluk and Otu, Hasan H},
#   booktitle={Multiple Sequence Alignment Methods},
#   pages={45--58},
#   year={2014},
#   publisher={Springer}
# }
# 
# @inproceedings{DBLP:conf/patmos/ShahWSB14,
#   author    = {Syed Abbas Ali Shah and
#                Jan Wagner and
#                Thomas Schuster and
#                Mladen Berekovic},
#   title     = {A lightweight-system-level power and area estimation methodology for
#                application specific instruction set processors},
#   booktitle = {24th International Workshop on Power and Timing Modeling, Optimization
#                and Simulation, PATMOS), Palma de Mallorca, Spain, September 29 -
#                Oct. 1, 2014},
#   pages     = {1--5},
#   publisher = {{IEEE}},
#   year      = {2014},
#   url       = {http://dx.doi.org/10.1109/PATMOS.2014.6951886},
#   doi       = {10.1109/PATMOS.2014.6951886},
#   timestamp = {Tue, 18 Nov 2014 12:34:31 +0100},
#   biburl    = {http://dblp.uni-trier.de/rec/bib/conf/patmos/ShahWSB14},
#   bibsource = {dblp computer science bibliography, http://dblp.org}
# }
# 
# 
# @inproceedings{kay2015good,
#   title={How Good is 85\%? A Survey Tool to Connect Classifier Evaluation to Acceptability of Accuracy},
#   author={Kay, Matthew and Patel, Shwetak N and Kientz, Julie A},
#   booktitle={Proceedings of the 33rd Annual ACM Conference on Human Factors in Computing Systems},
#   pages={347--356},
#   year={2015},
#   organization={ACM}
# }
# """


from django.test import LiveServerTestCase
from django.contrib.auth.models import User
from selenium import webdriver
from time import sleep
from publications.tests import tests
from publications.models import Publication
# -*- coding: utf-8 -*-


class LiveTests(LiveServerTestCase):
	fixtures = ['initial_data.json', 'test_data.json']
	urls = 'publications.tests.urls'

	@classmethod
	def setUpClass(cls):
		options = webdriver.firefox.options.Options()
		options.add_argument('--headless')
		cls.selenium = webdriver.Firefox(options=options)
		super(LiveTests, cls).setUpClass()


	@classmethod
	def tearDownClass(cls):
		cls.selenium.quit()
		super(LiveTests, cls).tearDownClass()


	def setUp(self):
		User.objects.create_superuser('admin', 'admin@test.de', 'admin')

		# login
		self.selenium.get('{0}{1}'.format(self.live_server_url, '/admin/'))

# Path: publications/tests/tests.py
# class Tests(TestCase):
# 	def setUp(self):
# 	def test_authors(self):
# 	def test_citekey(self):
# 	def test_custom_links(self):
# 	def test_publications(self):
# 	def test_bibtex_import(self):
# 	def test_unapi(self):
# 	def test_admin(self):
# 	def test_extras(self):
# TEST_BIBLIOGRAPHY_COUNT = 9
# TEST_BIBLIOGRAPHY = r"""
# @article{Bethge2002c,
#   author = "M. Bethge and D. Rotermund and K. Pawelzik",
#   title = "Optimal short-term population coding: when Fisher information fails",
#   year = 2002,
#   journal = "Neural Computation",
#   month = "Oct",
#   keywords = "population coding, fisher information",
#   doi = "10.1162/08997660260293247",
#   url = "http://www.mitpressjournals.org/doi/abs/10.1162/08997660260293247"
# }
# 
# @article{Simovski2011,
#   author =        {Simovski, Constantin R.},
#   journal =       {J. Opt.},
#   month =         jan,
#   number =        {1},
#   pages =         {013001},
#   title =         {{On electromagnetic characterization and
#                    homogenization of nanostructured metamaterials}},
#   volume =        {13},
#   year =          {2011},
#   doi =           {10.1088/2040-8978/13/1/013001},
#   issn =          {2040-8978},
#   url =           {http://stacks.iop.org/2040-8986/13/i=1/
#                   a=013001?key=crossref.7321766a6630b917c6f066f2abc1e2cc},
# }
# 
# @inproceedings{gerwinn2008bayesian,
#   title={Bayesian inference for spiking neuron models with a sparsity prior},
#   author={Gerwinn, Sebastian and Macke, Jakob and Seeger, Matthias and Bethge, Matthias},
#   booktitle={Proceedings of the 21st Annual Conference on Neural Information Processing Systems},
#   number={EPFL-CONF-161311},
#   pages={529--536},
#   year={2008}
# }
# 
# @article{hafner2000dynamical,
#   title={A dynamical model of the inner Galaxy},
#   author={H{\"a}fner, Ralf and Evans, N Wyn and Dehnen, Walter and Binney, James},
#   journal={Monthly Notices of the Royal Astronomical Society},
#   volume={314},
#   number={3},
#   pages={433--452},
#   year={2000},
#   publisher={Oxford University Press}
# }
# 
# @misc{test:2009,
#     title = "Test",
#     author = {Last-Name, First and Peter van der Markt III and Test and Gauss II CF},
#     year = 2009
# }
# 
# @article{DBLP:journals/corr/KummererWB14,
#  author    = {Matthias K{\"{u}}mmerer and
#               Thomas Wallis and
#               Matthias Bethge},
#  title     = {How close are we to understanding image-based saliency?},
#  journal   = {CoRR},
#  year      = {2014},
#  volume    = {abs/1409.7686},
#  url       = {http://arxiv.org/abs/1409.7686},
#  timestamp = {Mon, 27 Oct 2014 13:50:21 +0100},
#  biburl    = {http://dblp.uni-trier.de/rec/bib/journals/corr/KummererWB14},
#  bibsource = {dblp computer science bibliography, http://dblp.org}
# }
# @incollection{dougan2014objective,
#   title={Objective Functions},
#   author={Do{\u{g}}an, Haluk and Otu, Hasan H},
#   booktitle={Multiple Sequence Alignment Methods},
#   pages={45--58},
#   year={2014},
#   publisher={Springer}
# }
# 
# @inproceedings{DBLP:conf/patmos/ShahWSB14,
#   author    = {Syed Abbas Ali Shah and
#                Jan Wagner and
#                Thomas Schuster and
#                Mladen Berekovic},
#   title     = {A lightweight-system-level power and area estimation methodology for
#                application specific instruction set processors},
#   booktitle = {24th International Workshop on Power and Timing Modeling, Optimization
#                and Simulation, PATMOS), Palma de Mallorca, Spain, September 29 -
#                Oct. 1, 2014},
#   pages     = {1--5},
#   publisher = {{IEEE}},
#   year      = {2014},
#   url       = {http://dx.doi.org/10.1109/PATMOS.2014.6951886},
#   doi       = {10.1109/PATMOS.2014.6951886},
#   timestamp = {Tue, 18 Nov 2014 12:34:31 +0100},
#   biburl    = {http://dblp.uni-trier.de/rec/bib/conf/patmos/ShahWSB14},
#   bibsource = {dblp computer science bibliography, http://dblp.org}
# }
# 
# 
# @inproceedings{kay2015good,
#   title={How Good is 85\%? A Survey Tool to Connect Classifier Evaluation to Acceptability of Accuracy},
#   author={Kay, Matthew and Patel, Shwetak N and Kientz, Julie A},
#   booktitle={Proceedings of the 33rd Annual ACM Conference on Human Factors in Computing Systems},
#   pages={347--356},
#   year={2015},
#   organization={ACM}
# }
# """


# Path: publications/tests/tests_live.py
from django.test import LiveServerTestCase
from django.contrib.auth.models import User
from selenium import webdriver
from time import sleep
from publications.tests import tests
from publications.models import Publication

# -*- coding: utf-8 -*-


class LiveTests(LiveServerTestCase):
	fixtures = ['initial_data.json', 'test_data.json']
	urls = 'publications.tests.urls'

	@classmethod
	def setUpClass(cls):
		options = webdriver.firefox.options.Options()
		options.add_argument('--headless')
		cls.selenium = webdriver.Firefox(options=options)
		super(LiveTests, cls).setUpClass()


	@classmethod
	def tearDownClass(cls):
		cls.selenium.quit()
		super(LiveTests, cls).tearDownClass()


	def setUp(self):
		User.objects.create_superuser('admin', 'admin@test.de', 'admin')

		# login
		self.selenium.get('{0}{1}'.format(self.live_server_url, '/admin/'))

		username_input = self.selenium.find_element_by_name("username")