# Path: src/lib/libyaml.py
# class LibYaml:
# 	def __init__(self, directory=expanduser("~/.betcon/config.yml")):
# 		self.directory = directory
# 		checkFileExist(expanduser("~/.betcon"))
# 		self.config = self.load()
# 		self.stake = self.config["stake"]
# 		self.interface = self.config["interface"]
# 
# 	def load(self):
# 		if not os.path.exists(self.directory):
# 			self.initConfig()
# 
# 		stream = open(self.directory, 'r')
# 		config = yaml.load(stream)
# 		stream.close()
# 		return config
# 
# 	def initConfig(self):
# 		data = {'stake': {'percentage': 1.0, 'stake': 0, 'type': 1}, 'interface': {'coin': '€', 'bookieCountry': 'N', 'lang': 'es'}}
# 
# 		stream = open(self.directory, 'w')
# 		yaml.dump(data, stream, default_flow_style=False)
# 		stream.close()
# 
# 	def save(self):
# 		stream = open(self.directory, 'w')
# 		yaml.dump(self.config, stream, default_flow_style=False)
# 		stream.close()


from unittest import TestCase
from hamcrest import assert_that, is_
from src.lib.libyaml import LibYaml
import os


class TestLibYaml(TestCase):
	lib = LibYaml("/tmp/test.yml")

	def test_load(self):
		config = {'stake': {'percentage': 1.0, 'stake': 0, 'type': 1}}

		assert_that(config, self.lib.load())

	def test_save(self):

# Path: src/lib/libyaml.py
# class LibYaml:
# 	def __init__(self, directory=expanduser("~/.betcon/config.yml")):
# 		self.directory = directory
# 		checkFileExist(expanduser("~/.betcon"))
# 		self.config = self.load()
# 		self.stake = self.config["stake"]
# 		self.interface = self.config["interface"]
# 
# 	def load(self):
# 		if not os.path.exists(self.directory):
# 			self.initConfig()
# 
# 		stream = open(self.directory, 'r')
# 		config = yaml.load(stream)
# 		stream.close()
# 		return config
# 
# 	def initConfig(self):
# 		data = {'stake': {'percentage': 1.0, 'stake': 0, 'type': 1}, 'interface': {'coin': '€', 'bookieCountry': 'N', 'lang': 'es'}}
# 
# 		stream = open(self.directory, 'w')
# 		yaml.dump(data, stream, default_flow_style=False)
# 		stream.close()
# 
# 	def save(self):
# 		stream = open(self.directory, 'w')
# 		yaml.dump(self.config, stream, default_flow_style=False)
# 		stream.close()


# Path: test/lib/test_libYaml.py
from unittest import TestCase
from hamcrest import assert_that, is_
from src.lib.libyaml import LibYaml
import os



class TestLibYaml(TestCase):
	lib = LibYaml("/tmp/test.yml")

	def test_load(self):
		config = {'stake': {'percentage': 1.0, 'stake': 0, 'type': 1}}

		assert_that(config, self.lib.load())

	def test_save(self):

		valor = {'test': 'valor'}